#include <iostream>
#include <climits>

int GetMaxPrimeFactor(int n){
    int largest = -1;
    while(n%2==0){
        largest = 2;
        n /= 2;
    }

    int temp = n;
    for(int i=3; i*i <= temp; i+=2){
        while(n%i == 0){
            largest = i;
            n /= i;
        }
    }

    if(n>1){
        largest = n;
    }

    return largest;

}



/**
 * 最大质因数
 */
int main(){

    int N;
    std::cin >> N;

    int maxPrimeFactor = INT_MIN;
    int res;
    for(int i=0; i<N; i++){
        int Ai;
        std::cin >> Ai;

        int temp = GetMaxPrimeFactor(Ai);
        if(temp>maxPrimeFactor){
            maxPrimeFactor = temp;
            res = Ai;
        }
    }

    std::cout << res;

    return 0;
}